package org.dtrd.modules.shop.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.shop.entity.bean.OrderJoinProductDetail;


/**
 * <p>
 * 金蝶商品与订单的关联关系表
 * </p>
 *
 * @author sun
 * @since 2022-07-23
 */
@Getter
@Setter
@TableName("dtrd_ent_shc_rd_order_join_product")
public class DtrdEntShcRdOrderJoinProduct {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 订单id
     */
    @TableField("order_id")
    private String orderId;

    /**
     * 商品id
     */
    @TableField("product_id")
    private String productId;

    /**
     * 商品分类
     */
    @TableField("product_category")
    private Integer productCategory;

    /**
     * 商品名称
     */
    @TableField("product_name")
    private String productName;

    /**
     * 商品价格
     */
    @TableField("product_price")
    private Integer productPrice;

    /**
     * 商品折扣价格
     */
    @TableField("product_discount_price")
    private Integer productDiscountPrice;

    /**
     * 商品对应服务包id
     */
    @TableField("product_service_id")
    private Integer productServiceId;

    /**
     * 商品数量
     */
    @TableField("product_num")
    private Integer productNum;

    /**
     * 是否删除
     */
    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    @TableField("create_time")
    private Date createTime;

    public DtrdEntShcRdOrderJoinProduct init() {
        isDel = 0;
        createTime = new Date();
        return this;
    }

    public DtrdEntShcRdOrderJoinProduct parseFromDto(OrderJoinProductDetail dto) {
        dataId = dto.getDataId();
        orderId = dto.getOrderId();
        productId = dto.getProductId();
        productCategory = dto.getProductCategory();
        productName = dto.getProductName();
        productPrice = dto.getProductPrice();
        productDiscountPrice = dto.getProductDiscountPrice();
        productServiceId = dto.getProductServiceId();
        productNum = dto.getProductNum();
        return this;
    }


}
